<?
load_model('Common');
class SinglePage extends Common {
	protected $_name ="single_page";
	protected $_primary = 'sp_id';
	
	public function get_sp_list(){
		$arr = $this->fetchAll(null,"sp_id desc")->toArray();
		return $arr;
	}

	public function get_sp_info($id){
		$db = $this->getAdapter();
		$where = $db->quoteInto('sp_id = ?', $id);
		return $this->fetchRow($where)->toArray();
	}
	
	function add_sp($data){
		$dataInsert = array(
		    'sp_id' => $data['sp_id'],
		    'sp_title' => $data['sp_title'],
		    'sp_content' => $data['sp_content'],
		    'sp_date' => $data['sp_date'],
		);
		return $this->insert($dataInsert);
	}
	
	function update_sp($id, $data){
		$db = $this->getAdapter();
		$where = $db->quoteInto('sp_id = ?', $id);
		return $this->update($data, $where);
	}
	
	function del_sp($id){
		$db = $this->getAdapter();
		$where = $db->quoteInto('sp_id = ?', $id);
		return $this->delete($where);
	}
	
}

?>